<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="renderer" content="webkit" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <title>千峰教育大前端Vue教学</title>
  <script src="https://cdn.staticfile.org/petite-vue/0.4.1/petite-vue.umd.min.js"></script>
</head>

<body style="margin:100px;font-size:22px;">
  <div v-scope>
    <div v-color="color">num = {{ num }}</div>
    <div v-color.fang:yun="'green'">num = {{ num }}</div>
  </div>

  <script>
    const redDirective = ({ el, exp, arg, modifiers, get, effect }) => {
      console.log('=================', { el, exp, arg, modifiers, get, effect });
      effect(() => {
        el.style.color = get()
      })
    };
    PetiteVue.createApp({
      num: 0,
      color: 'red',
    }).directive('color', redDirective).mount()
  </script>
</body>

</html>